#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QThread>
#include <QMainWindow>
#include <QPushButton>
#include <QDebug>

class WorkerThread : public QThread {
    Q_OBJECT
public:
    WorkerThread(QObject *parent = nullptr){
        Q_UNUSED(parent);
    }
    ~WorkerThread() override {

    }
    void run() override;
};

class WorkerThread2 : public QObject {
    Q_OBJECT
public:
    WorkerThread2(QObject *parent = nullptr){
        Q_UNUSED(parent);
    }
    ~WorkerThread2(){

    }
public slots:
    void workone(const QString& str) {
        qDebug() << __LINE__ << str << endl;
        QThread::sleep(2);
        qDebug() << __LINE__ << str << endl;
    }
};


class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
private:
    QPushButton* mPushButton = nullptr;
    WorkerThread* worker = nullptr;
    WorkerThread2* worker2 = nullptr;
    QThread workThread;
private slots:
    void clicked();
signals:
    void startWorker(const QString&);
};

#endif // MAINWINDOW_H
